<template>
	<view>
		<cu-custom bgColor="bg-black" :isBack="false">
			<block slot="right"><text @tap='tocalendar' style="margin-left: 40rpx; " class="cuIcon-back"></text></block>
			<block slot="content">{{date}}</block>
		</cu-custom>
		<scroll-view scroll-y class="page">
			<block v-for="(item,index) in list" :key="index">
				<view class="cu-bar bg-white solid-bottom " style="min-height: 80rpx;">
					<view class="action">
						<view>
							<image :src="item.avatar =='' ? '/static/avatar.png':item.avatar" class='avatar' mode="widthFix" lazy-load></image>
						</view>
						<view>{{item.nickname}}</view>
					</view>
					<view style="margin-right: 20rpx;">{{item.moment_createtime.slice(11)}}</view>
				</view>
				<view class="bg-white" style="padding: 20rpx;">
					<view class="text-left " style="white-space:pre-wrap;padding: 5rpx;">{{item.moment_content}}</view>
				</view>
			</block>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				date: "",
				list: [],
				userInfo: {
					ext_info: {
						yesapi_avatar: "",
						yesapi_email: "",
						yesapi_expiration_time: "",
						yesapi_mobile: "",
						yesapi_nickname: "",
						yesapi_points: 0,
						yesapi_real_name: "",
						yesapi_reg_note: "",
						yesapi_reg_source: "",
						yesapi_sex: ""
					},
					register_ip: "",
					register_time: "",
					role: "",
					rolename: "",
					status: 0,
					username: "",
					uuid: "",
					token: ""
				}

			}
		},
		onLoad(options) {
			this.date = options.date
		},
		mounted() {
			var info = this.checkLogin("home", '2');
			if (info) {
				this.userInfo = info;
			}
			this.getlist()
		},
		methods: {
			tocalendar() {
				uni.redirectTo({
					url: "../calendar"
				})
			},
			async getlist() {
				var options = {
					data: {
						s: "SVIP.Szskj_MyApi.AGetOkayapimoment",
						user_uuid: this.userInfo.uuid,
						uuid: this.userInfo.uuid,
						date: this.date
					},
					method: "POST"
				}
				const res = await this.$myRuquest(options)
				if (res.data.data.err_code == 0) {
					this.list = res.data.data.list;
				} else {
					uni.showToast({
						icon: '',
						position: 'bottom',
						title: res.data.data.err_msg
					});

				}

			}

		}
	}
</script>

<style>
	.avatar {
		width: 38rpx;
		height: 38rpx;
		border-radius: 100%;
		margin-right: 10rpx;
	}
</style>
